# This sample code uses the Appium python client
# pip install Appium-Python-Client
# Then you can paste this into a file and simply run with Python

# %%
import random
import itertools
from appium.webdriver.common.touch_action import TouchAction
import time
from appium import webdriver
from appium.webdriver.webdriver import WebDriver
from appium.webdriver import WebElement
# 这一句只是为了import common 在 sys.path.append之后
if True:
    import sys
    import os
    sys.path.append(os.path.abspath('.'))
    import common
# 类型提示
driver: WebDriver
driver = common.get_driver()
for i in [4]:
    common.print_test_path(__file__, i)

# %%
ele: WebElement
ele = driver.find_element_by_id(
    "com.tencent.videolite.android:id/feed_view_pager")
print(ele.location)
print(ele.size)
'''
{'x': 0, 'y': 122}
{'height': 1086, 'width': 720}
'''

def get_point(ele:WebElement,rate_x,rate_y):
    x_min = ele.location['x']
    y_min = ele.location['y']
    x_max = x_min + ele.size["width"]
    y_max = y_min + ele.size["height"]
    x = x_min+rate_x*(x_max-x_min)
    y = y_min+rate_y*(y_max-y_min)
    return {'x':x,'y':y}

print(get_point(ele,0.3,0.7))

 # %%
# common.manul_choose()
common.print_result(result, __file__)

# %%
# driver.quit()
